/* -*- C++ -*- */

%{

#define YY_NO_UNPUT

#include <iostream>
using namespace std;

unsigned int current_line = 1;

// declared in parser.cc
extern const char *leaf_name; 
 
%}

D                               [0-9]
L                               [a-zA-Z_/-]

FLOAT                           -?{D}+|-?[0-9]*\.[0-9]+|(-?[0-9]*\.[0-9]+|-?{D}+)?[eE][+-]?{D}+


%%

"("				return '(';
")"				return ')';
","				return ',';
";"				return ';';

":"				return ':';
{FLOAT}				leaf_name = yytext; return 'f';

[a-zA-Z][^,:(); \t\n]*		leaf_name = yytext; return 'i';
'[^']*'				yytext[strlen(yytext)-1] = '\0'; leaf_name = yytext+1; return 'i';



\n\r				current_line++;
\r\n				current_line++;
\n				current_line++;
[\t\r ]				// ignore whitespace



.               { 
  cerr << "illegal character in input `"
       << yytext[0] << "' at line `"
       << current_line << "'\n";
  exit(1);
}

%%

int
yywrap (void)
{
    return 1;
}
